package com.cristina.attention.handler;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 发送渠道 -> Handler 的映射关系
 *
 * @author by superman
 */
@Component
public class HandlerHolder {

    private Map<Integer, Handler> handlers = new HashMap<Integer, Handler>(32);
    
    public void putHandler(Integer code, Handler handler) {
        handlers.put(code, handler);
    }

    public Handler route(Integer imCode) {
        return handlers.get(imCode);
    }
}
